function formatDepMedal(value) {
    var weekMedal = Number(value);// 获得的奖牌
    if (weekMedal === 0) {
        return "<span style='color:#beb2b2'>未获得奖牌</span>";
    }
    var monthMedal = 0;
    var yearMedal = 0;// 年冠军
    if (weekMedal >= 30) {
        monthMedal = parseInt(weekMedal / 30);
        weekMedal = Number(weekMedal % 30);
        if (monthMedal >= 2) {
            yearMedal = parseInt(monthMedal / 2);
            monthMedal = Number(monthMedal % 2);
        }
    }
    var result = '';
    if (monthMedal > 0) {
        var monthMedalImg = " <img title='月冠军' class='prize' src='http://vod.136.i2863.com/static/record/image/month_golden.png'>";
        result = monthMedalImg + "x" + Number(monthMedal) + result;
    }
    if (yearMedal > 0) {
        var yearMedalImg = " <img title='年冠军' class='prize' src='http://vod.136.i2863.com/static/record/image/year_golden.png'>";
        result = yearMedalImg + "x" + Number(yearMedal) + result;
    }
    if (monthMedal === 0 && yearMedal === 0) {
        return "<span style='color:#beb2b2'>未获得奖牌</span>";
    }
    return result;
}

function formatStreetMedal(value) {
    var weekMedal = Number(value);// 获得的奖牌
    if (weekMedal === 0) {
        return "<span style='color:#beb2b2'>未获得奖牌</span>";
    }
    var quarterMedal = 0;// 季度冠军
    var halfYearMedal = 0;// 半年冠军
    var yearMedal = 0;// 年冠军
    if (weekMedal >= 10) {
        quarterMedal = parseInt(weekMedal / 10);
        weekMedal = Number(weekMedal % 10);
        if (quarterMedal >= 3) {
            halfYearMedal = parseInt(quarterMedal / 3);
            quarterMedal = Number(quarterMedal % 3);
            if (halfYearMedal >= 2) {
                //大于24小时
                yearMedal = parseInt(halfYearMedal / 2);
                halfYearMedal = Number(halfYearMedal % 2);
            }
        }
    }
    var result = '';
    if (weekMedal > 0) {
        var weekMedalImg = " <img title='周冠军' class='prize' src='http://vod.136.i2863.com/static/record/image/week_golden.png'>";
        result = weekMedalImg + "x" + Number(weekMedal) + result;
    }
    if (quarterMedal > 0) {
        var quarterMedalImg = " <img title='季度冠军' class='prize' src='http://vod.136.i2863.com/static/record/image/quarter_golden.png'>";
        result = quarterMedalImg + "x" + Number(quarterMedal) + result;
    }
    if (halfYearMedal > 0) {
        var halfYearMedalImg = " <img title='半年冠军' class='prize' src='http://vod.136.i2863.com/static/record/image/half_year_golden.png'>";
        result = halfYearMedalImg + "x" + Number(halfYearMedal) + result;
    }
    if (yearMedal > 0) {
        var yearMedalImg = " <img title='年冠军' class='prize' src='http://vod.136.i2863.com/static/record/image/year_golden.png'>";
        result = yearMedalImg + "x" + Number(yearMedal) + result;
    }
    if (weekMedal === 0 && quarterMedal === 0 && halfYearMedal === 0 && yearMedal === 0) {
        return "<span style='color:#beb2b2'>未获得奖牌</span>";
    }
    return result;
}

function formatMedal(value, type) {
    if (type == 0) {
        return formatStreetMedal(value)
    } else if (type == 1) {
        return formatDepMedal(value)
    }
}


function MedalName(value) {
    switch (value) {
        case 1:
            return "周冠军";
        case 2:
            return "周亚军";
        case 3:
            return "周季军";
        case 4:
            return "月冠军";
        case 5:
            return "月亚军";
        case 6:
            return "月季军";
        case 7:
            return "季冠军";
        case 8:
            return "季亚军";
        case 9:
            return "季季军";
        case 10:
            return "半年冠军";
        case 11:
            return "半年亚军";
        case 12:
            return "半年季军";
        case 13:
            return "年冠军";
        case 14:
            return "年亚军";
        case 15:
            return "年季军";
    }
}